/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 游戏容器 */
.game-container {
    width: 100%;
    max-width: 800px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 20px;
}

/* 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-title {
    color: #333;
    margin-bottom: 15px;
    font-size: 28px;
}

/* 游戏统计信息 */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: bold;
    color: #4a5568;
    font-size: 18px;
}

/* 控制按钮 */
.control-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

/* 游戏板 */
.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

/* 卡片样式 */
.card {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 1000px; /* 3D效果的透视 */
}

.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-weight: bold;
}

.card-front {
    background: white;
    border: 2px solid #e2e8f0;
    color: #4a5568;
    transform: rotateY(180deg);
}

/* 模态框 */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
    z-index: 1000;
}

.game-modal.show {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.modal-content p {
    color: #666;
    margin-bottom: 15px;
}

.modal-stats {
    margin: 20px 0;
}

.modal-stats p {
    margin-bottom: 8px;
    font-size: 16px;
}

#record-message {
    color: #38a169;
    font-weight: bold;
    margin-top: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-board {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .card-front, .card-back {
        font-size: 28px;
    }
    
    .game-stats {
        gap: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .game-container {
        padding: 15px;
    }
    
    .game-title {
        font-size: 24px;
    }
    
    .game-board {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .card-front, .card-back {
        font-size: 24px;
        border-radius: 8px;
    }
    
    .game-stats {
        gap: 15px;
    }
    
    .stat-value {
        font-size: 16px;
    }
}